<template>
  <div>
    <!--残值记录-->
    <el-card class="box-card" shadow="never">
      <div slot="header" class="header-card">
        <span class="header-card-title">残值记录</span>
      </div>
      <el-row>
        <el-col :span="24">
          <el-table :data="ruleForm.residualValueLogs" border style="width: 100%">
            <el-table-column label="操作" align="center" fixed="left" width="200">
              <template #default="{row}">
                <el-button size="mini" type="text" @click="handleView(row,1)">
                  查看
                </el-button>
              </template>
            </el-table-column>

            <el-table-column label="初期残值(元)" prop="initialResidualValue" min-width="100" show-overflow-tooltip
                             align="center">
              <template #default="{row}">
                {{ format_thousand(row.initialResidualValue) }}
              </template>
            </el-table-column>

            <el-table-column label="修改前残值(元)" prop="beforeResidualValue" min-width="100" show-overflow-tooltip
                             align="center">
              <template #default="{row}">
                {{ format_thousand(row.beforeResidualValue) }}
              </template>
            </el-table-column>

            <el-table-column label="申请修改残值(元)" prop="commitResidualValue" min-width="130" show-overflow-tooltip
                             align="center">
              <template #default="{row}">
                {{ format_thousand(row.commitResidualValue) }}
              </template>
            </el-table-column>

            <el-table-column label="提交时间" min-width="120" show-overflow-tooltip align="center">
              <template #default="{row}">
                {{ row.commitTime ? $dayjs(row.commitTime).format('YYYY-MM-DD') : '' }}
              </template>
            </el-table-column>

            <el-table-column prop="commitName" label="提交人" min-width="100" show-overflow-tooltip align="center"/>

            <el-table-column label="审批状态" min-width="120" show-overflow-tooltip align="center">
              <template #default="{row}">
                {{ selectDictLabel(dict.type.salvage_approval_status, row.approvalStatus) }}
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
    </el-card>
    <!--撤销处置记录-->
    <el-card class="box-card" shadow="never" >
      <div slot="header" class="header-card">
        <span class="header-card-title">撤销处置记录</span>
      </div>
      <el-row>
        <el-col :span="24">
          <el-table :data="ruleForm.revocationDisposalLogs" border style="width: 100%">
            <el-table-column label="操作" align="center" fixed="left" width="100">
              <template #default="{row}">
                <el-button size="mini" type="text" @click="handleView(row,2)">
                  查看
                </el-button>
              </template>
            </el-table-column>

            <el-table-column label="说明" prop="a" min-width="500" show-overflow-tooltip align="center"/>

            <el-table-column label="提交时间" min-width="100" show-overflow-tooltip align="center">
              <template #default="{row}">
                {{ row.commitTime ? $dayjs(row.commitTime).format('YYYY-MM-DD') : '' }}
              </template>
            </el-table-column>

            <el-table-column label="提交人" min-width="130" show-overflow-tooltip prop="commitName" align="center"/>

            <el-table-column label="审批状态" min-width="120" show-overflow-tooltip align="center">
              <template #default="{row}">
                {{ selectDictLabel(dict.type.salvage_approval_status, row.approvalStatus) }}
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
    </el-card>
    <!--操作记录-->
    <el-card class="box-card" shadow="never" style="margin-bottom: 0">
      <div slot="header" class="header-card">
        <span class="header-card-title">操作记录</span>
      </div>
      <el-row>
        <el-col :span="24">
          <el-table :data="ruleForm.revocationOperateLogs" border style="width: 100%">

            <el-table-column label="操作节点" min-width="120" show-overflow-tooltip align="center">
              <template #default="{row}">
                {{ selectDictLabel(dict.type.operate_status, row.operateStatus) }}
              </template>
            </el-table-column>

            <el-table-column label="操作时间" min-width="100" show-overflow-tooltip align="center">
              <template #default="{row}">
                {{ row.commitTime ? $dayjs(row.commitTime).format('YYYY-MM-DD') : '' }}
              </template>
            </el-table-column>

            <el-table-column label="操作人" min-width="130" show-overflow-tooltip prop="commitName" align="center"/>


          </el-table>
        </el-col>
      </el-row>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'tabulationRecords', //残值记录 撤销处置记录  操作记录
  dicts: ["salvage_approval_status","operate_status"],
  props: {
    value: {
      type: Object,
      default: () => {
      },
    },
  },
  computed: {
    ruleForm: {
      get() {
        let that = this;
        const proxy = new Proxy(that.value, {
          get(target, key) {
            return Reflect.get(target, key);
          },
          set(target, key, value) {
            that.$emit("input", {...target, [key]: value});
            return true;
          },
        });
        return proxy;
      },
    },
  },
  watch: {},
  data() {
    return {
      tableData: [{a: '4545454545'}],
    };
  },
  created() {
  },
  mounted() {
  },
  methods: {
    //查看
    handleView(row, type) {
      if (type === 1) {
        this._toPage({
          path: "/VehicleDisposal/RoutineDisposal/EditSalvage",
          name: "EditSalvage",
          query: {
            type: "view",
            residualValueId: row.residualValueId,
            vehicleDisposalId:this.$route.query.id,
            status: 21,
            path:'RoutineHandleDetails'
          },
        });
      }
      if (type === 2) {
        this._toPage({
          path: "/VehicleDisposal/RoutineDisposal/RoutineApplyForCancel",
          name: 'RoutineApplyForCancel',
          query: {
            type: "view",
            residualValueId: row.residualValueId,
            path: 'RoutineHandleDetails',
            vehicleDisposalId:this.$route.query.id,
            status: 21
          }
        })
      }
    },
  },
};
</script>

<style scoped lang="scss">
@import "@/styles/cwgd/formScss.scss";
</style>


